package com.atguigu.algorithm;

public class BagProblem {
    public static int process2(int[] weights,int[] values,int i,int alreadyWeight,int alreadyValue,int bag){
        if(alreadyWeight>bag){
            return -values[i-1];
        }
        if(i==values.length){
            return alreadyValue;
        }
        return Math.max(process2(weights,values,i+1,alreadyWeight,alreadyValue,bag),process2(weights,values,i+1,alreadyWeight
        +weights[i],alreadyValue+values[i],bag));
    }
}
